package model

import (
	"book-hub/book-service/basic/config"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Image    string `gorm:"type:varchar(500);comment:头像"`
	Username string `gorm:"type:varchar(30);comment:用户名"`
	Password string `gorm:"type:char(32);comment:密码"`
	Number   int    `gorm:"type:int(11);comment:信誉分"`
}

func LoginUser(u *User) error {

	return config.DB.Create(&u).Error
}
func UserLogin(u *User, username string) error {

	return config.DB.Where("username=?", username).Find(&u).Error
}